import Vue from "vue";
import Router from "vue-router";
import Project from "@/components/Container/Project";
import Curriculum from "@/components/Container/Curriculum";
import User from "@/components/Container/User";
import Login from "@/components/Login/Login";
import Index from "@/components/Container/Index";
import ManageIndexPage from "@/components/Manage/ManageIndexPage";

Vue.use(Router);

export const constantRoutes = [
    // 动态路径参数 以冒号开头
    { path: '/project', component: Project },
    { path: '/curriculum', component: Curriculum },
    { path: '/user', component: User },
    { path: '/login', component: Login },
    { path: '/',component: Index,},
    { path: '/index',component: Index,},
    { path: '/ManageIndexPage',component: ManageIndexPage,},
];
const createRouter = () =>
    new Router({
        // mode: 'history', // require service support
        scrollBehavior: () => ({ y: 0 }),
        routes: constantRoutes
    });

const router = createRouter();

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
    const newRouter = createRouter();
    router.matcher = newRouter.matcher; // reset router
}

export default router;
